package cn.edu.bit.learn.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import cn.edu.bit.learn.form.ManageForm;
import cn.edu.bit.learn.tool.DbManager;

public class ManageDAO {
	public boolean login(ManageForm mf){
		DbManager dm = new DbManager();
		Connection conn =dm.getCon();
		String sql="select manageId,managePwd from manager where manageId=? and managePwd=?";
		//System.out.println(sql+"-------------------");
		PreparedStatement pstm=null;
		ResultSet rs=null;
		try {
			pstm = conn.prepareStatement(sql);
			pstm.setString(1, mf.getManageId());
			pstm.setString(2, mf.getManagePwd());
			rs=pstm.executeQuery();
			if(rs!=null){
				return true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			dm.closeResult(rs);
			dm.clostStmt(pstm);
			dm.closeConn(conn);
		}
		return false;
		
	}
}
